#!/usr/bin/python
#Derek & Paddy
import unittest
from ChessBoard import *

class testState2str(unittest.TestCase):

  def setUp(self):
    """ 
    SetUp data used for tests
    """
    self.testBoard = ChessBoard()
    self.testBoard.resetBoard()
   
  def testInit(self):
    """
    Test is not none 
    """
    self.assertTrue(self.testBoard is not None)

  def testBasic(self):
    """
    """
    a = self.testBoard.state2str()
    self.assertTrue(a != '')
   
  def testStateChanges(self):
    """
    """
    a = self.testBoard.state2str()
    self.testBoard.movePawn((1,6),(1,5))

    b = self.testBoard.state2str()

    self.assertTrue(a != b)

  def testFlagChanges(self):
    """
    """
    a = self.testBoard.state2str()
    self.assertTrue(self.testBoard._white_king_castle)
    self.testBoard._white_king_castle = False
    b = self.testBoard.state2str()
    self.assertNotEqual(a,b)
    self.assertEqual(str(0), b[-9])

if __name__ == "__main__":
  unittest.main()

